package com.minova.demo.controller;

import java.util.List;
import java.util.regex.Matcher;
import java.util.regex.Pattern;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import com.minova.demo.entity.TzArea;
import com.minova.demo.entity.TzProd;
import com.minova.demo.service.ITzAreaService;

@Controller
public class JspController {
	@Autowired
	private ITzAreaService iTzAreaService;
	
	@RequestMapping("index")
	public String index() {
		return "index";
	}
	
	@RequestMapping("test")
	public String test() {
		return "test";
	}
	
	@RequestMapping("edit")
	public String edit() {

		return "edit";
	}
	
	@RequestMapping("noticeManager")
	public String noticeManager() {
		return "noticeManager";
	}
	
	@RequestMapping("classify")
	public String classify() {
		return "classify";
	}
	
	@RequestMapping("pickManager")
	public String pickManager(){
		return "pickManager";
	}
	
	
	@RequestMapping("Area")
	@ResponseBody
	public List<TzArea> Area(){
		List<TzArea> list = iTzAreaService.select();//3715
		for(int i=0;i<list.size();i++) {
			if(list.get(i).getLevel()==1 || list.get(i).getLevel()==2) {
				list.get(i).setAlist(iTzAreaService.getArea(list.get(i).getAreaId()));
			}
		}
		return list;
	}
}
